<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

if( $_GET["transaction_id"]) // AND $_GET["category_id"] AND $_GET["item_desc"] AND $_GET["item_value"])
{
	$transaction_id = strip_tags($_GET["transaction_id"]);
    $profit_loss_id = strip_tags($_GET["profit_loss_id"]);
    $t_value = strip_tags($_GET["t_value"]);
	$t_currency_id = strip_tags($_GET["t_currency_id"]);
	$t_date = strip_tags($_GET["t_date"]);
	
	
	file_put_contents  ( "params_insert.txt", 
								"profit_loss_id '" .$profit_loss_id.
								"' transaction_id '" .$transaction_id.
								"' t_value '" .$t_value.
								"' t_currency_id '" .$t_currency_id.
								"' t_date '" .$t_date."'");
	 
	//Update Direct to database with SQL until Doctrine issue resolved
	$db_query = sprintf("UPDATE fin_transactions 
							SET profit_loss_id='".$profit_loss_id."',
								t_value='".$t_value."',
								t_currency_id='".$t_currency_id."'
								t_date='".$t_date."'
							WHERE transaction_id='".$transaction_id."'");
 
 	file_put_contents  ( "update_statement.txt", $db_query);   
 
 	$result = mysql_query($db_query);
    	if (!$result) {
        		die('invalid query');    // . mysql_error());
    		}
}

mysql_free_result( $result )

?>